package com.huan.social.security;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.social.security.SocialUser;
import org.springframework.social.security.SocialUserDetails;
import org.springframework.social.security.SocialUserDetailsService;
import org.springframework.stereotype.Service;

/**
 * spring social 中 user detail service impl
 *
 * @author huan.fu
 * @date 2018/9/25 - 15:09
 */
@Service
@Slf4j
public class SocialUserDetailServiceImpl implements SocialUserDetailsService, UserDetailsService {

	@Override
	public SocialUserDetails loadUserByUserId(String userId) {
		log.info("spring social 根据用户名:[{}]获取用户的信息.", userId);
		return new SocialUser("返回系统默认的用户", "默认的密码", null);
	}

	@Override
	public UserDetails loadUserByUsername(String username) {
		return loadUserByUserId(username);
	}
}
